var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, t) {
        e.__proto__ = t;
    } || function(e, t) {
        for (var a in t) t.hasOwnProperty(a) && (e[a] = t[a]);
    })(e, t);
}, function(e, t) {
    function a() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (a.prototype = t.prototype, 
    new a());
}), a = this && this.__decorate || function(e, t, a, r) {
    var i, n = arguments.length, s = n < 3 ? t : null === r ? r = Object.getOwnPropertyDescriptor(t, a) : r;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, r); else for (var d = e.length - 1; 0 <= d; d--) (i = e[d]) && (s = (n < 3 ? i(s) : 3 < n ? i(t, a, s) : i(t, a)) || s);
    return 3 < n && s && Object.defineProperty(t, a, s), s;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("GameData"), s = e("LoadManager"), c = e("Global"), l = cc._decorator, d = l.ccclass, u = l.property, p = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.checkMark = null, e.sprite = null, e.numLabel = null, e.nameLabel = null, 
        e;
    }
    return i(e, t), e.prototype.start = function() {}, e.prototype.init = function(t) {
        switch (this.sprite.node.scale = 1, t.type) {
          case c.RewardType.DIAMOND:
            t.data && !isNaN(t.data.num) && (this.numLabel.string = GA.formatNumber(t.data.num)), 
            this.nameLabel.string = "钻石", s.default.getInstance().loadSpriteFrame({
                url: "image/draw/钻石",
                sprite: this.sprite
            });
            break;

          case c.RewardType.MONEY:
            t.data && !isNaN(t.data.num) && (t.data.num = c.G.getPrice(r.GD.topRank) * t.data.num, 
            this.numLabel.string = GA.formatNumber(t.data.num)), this.nameLabel.string = "金币", 
            s.default.getInstance().loadSpriteFrame({
                url: "image/draw/金币",
                sprite: this.sprite
            });
            break;

          case c.RewardType.SKIN:
            var e;
            t.data && !isNaN(t.data.idx) && 0 < (a = c.G.personModelList.filter(function(e) {
                return e.id == t.data.idx;
            })).length && (-1 < r.GD.skins.indexOf(a[0].id) && 0 < (e = this.getRealSkin()).length ? (this.nameLabel.string = e[0].m + "(试用)", 
            s.default.getInstance().loadSpriteFrame({
                url: "image/skin/" + e[0].id,
                sprite: this.sprite
            })) : (this.nameLabel.string = a[0].m + "(试用)", s.default.getInstance().loadSpriteFrame({
                url: "image/skin/" + a[0].id,
                sprite: this.sprite
            })));
            break;

          case c.RewardType.PET:
            this.nameLabel.string = "机械狗", s.default.getInstance().loadSpriteFrame({
                url: "image/draw/机械狗",
                sprite: this.sprite
            });
            break;

          case c.RewardType.ARM:
            var a;
            this.sprite.node.scale = .4, t.data && !isNaN(t.data.idx) && (3e3 <= t.data.idx ? 0 < (a = c.G.olympicGunModelList.filter(function(e) {
                return e.id == t.data.idx;
            })).length && (this.nameLabel.string = a[0].m + "(试用)", s.default.getInstance().loadSpriteFrame({
                url: "texture/armOlympic/" + a[0].id,
                sprite: this.sprite
            })) : 2e3 <= t.data.idx ? 0 < (a = c.G.drawGunModelList.filter(function(e) {
                return e.id == t.data.idx - 2e3;
            })).length && (this.nameLabel.string = a[0].m + "(试用)", s.default.getInstance().loadSpriteFrame({
                url: "image/arm_draw/" + a[0].id,
                sprite: this.sprite
            })) : 1e3 <= t.data.idx ? 0 < (a = c.G.eggGunModelList.filter(function(e) {
                return e.id == t.data.idx - 1e3;
            })).length && (this.nameLabel.string = a[0].m + "(试用)", s.default.getInstance().loadSpriteFrame({
                url: "image/arm3/" + a[0].id,
                sprite: this.sprite
            })) : 0 < (a = c.G.gunModelList.filter(function(e) {
                return e.id == t.data.idx;
            })).length && (this.nameLabel.string = a[0].m + "(试用)", s.default.getInstance().loadSpriteFrame({
                url: "image/arm/" + a[0].id,
                sprite: this.sprite
            })));
            break;

          case c.RewardType.PIECE:
            t.data && !isNaN(t.data.num) && (this.numLabel.string = GA.formatNumber(t.data.num)), 
            this.nameLabel.string = "碎片", s.default.getInstance().loadSpriteFrame({
                url: "image/draw/碎片",
                sprite: this.sprite
            });
            break;

          case c.RewardType.DRAGON:
            this.nameLabel.string = "机械龙", s.default.getInstance().loadSpriteFrame({
                url: "image/draw/机械龙",
                sprite: this.sprite
            });
            break;

          case c.RewardType.ELF:
            this.nameLabel.string = "小精灵", s.default.getInstance().loadSpriteFrame({
                url: "image/draw/小精灵",
                sprite: this.sprite
            });
            break;

          case c.RewardType.STONE:
            this.nameLabel.string = "进化石", s.default.getInstance().loadSpriteFrame({
                url: "image/draw/进化石",
                sprite: this.sprite
            });
        }
    }, e.prototype.refresh = function(e) {
        e.type === c.RewardType.MONEY ? (this.sprite.node.scale = 1, e.data && !isNaN(e.data.num) && (this.numLabel.string = GA.formatNumber(e.data.num)), 
        this.nameLabel.string = "金币", s.default.getInstance().loadSpriteFrame({
            url: "image/draw/金币",
            sprite: this.sprite
        })) : this.init(e);
    }, e.prototype.getRealSkin = function() {
        return c.G.personModelList.filter(function(e) {
            return 100 <= e.id && r.GD.skins.indexOf(e.id) < 0;
        });
    }, a([ u(cc.Node) ], e.prototype, "checkMark", void 0), a([ u(cc.Sprite) ], e.prototype, "sprite", void 0), 
    a([ u(cc.Label) ], e.prototype, "numLabel", void 0), a([ u(cc.Label) ], e.prototype, "nameLabel", void 0), 
    a([ d ], e);
}(cc.Component);

n.default = p;